var e = require;
var t = module;
var n = exports;
var o,
    i =
        (this && this.__extends) ||
        ((o = function (e, t) {
            return (o =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (e, t) {
                        e.__proto__ = t;
                    }) ||
                function (e, t) {
                    for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
                })(e, t);
        }),
        function (e, t) {
            function n() {
                this.constructor = e;
            }
            o(e, t), (e.prototype = null === t ? Object.create(t) : ((n.prototype = t.prototype), new n()));
        }),
    r =
        (this && this.__decorate) ||
        function (e, t, n, o) {
            var i,
                r = arguments.length,
                a = r < 3 ? t : null === o ? (o = Object.getOwnPropertyDescriptor(t, n)) : o;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) a = Reflect.decorate(e, t, n, o);
            else
                for (var s = e.length - 1; 0 <= s; s--)
                    (i = e[s]) && (a = (r < 3 ? i(a) : 3 < r ? i(t, n, a) : i(t, n)) || a);
            return 3 < r && a && Object.defineProperty(t, n, a), a;
        },
    a =
        (this && this.__awaiter) ||
        function (e, a, s, c) {
            return new (s = s || Promise)(function (n, t) {
                function o(e) {
                    try {
                        r(c.next(e));
                    } catch (e) {
                        t(e);
                    }
                }
                function i(e) {
                    try {
                        r(c.throw(e));
                    } catch (e) {
                        t(e);
                    }
                }
                function r(e) {
                    var t;
                    e.done
                        ? n(e.value)
                        : ((t = e.value) instanceof s
                              ? t
                              : new s(function (e) {
                                    e(t);
                                })
                          ).then(o, i);
                }
                r((c = c.apply(e, a || [])).next());
            });
        },
    s =
        (this && this.__generator) ||
        function (e, n) {
            var o,
                i,
                r,
                a = {
                    label: 0,
                    sent: function () {
                        if (1 & r[0]) throw r[1];
                        return r[1];
                    },
                    trys: [],
                    ops: []
                },
                t = {next: s(0), throw: s(1), return: s(2)};
            return (
                "function" == typeof Symbol &&
                    (t[Symbol.iterator] = function () {
                        return this;
                    }),
                t
            );
            function s(t) {
                return function (e) {
                    return c([t, e]);
                };
            }
            function c(t) {
                if (o) throw new TypeError("Generator is already executing.");
                for (; a; )
                    try {
                        if (
                            ((o = 1),
                            i &&
                                (r =
                                    2 & t[0]
                                        ? i.return
                                        : t[0]
                                        ? i.throw || ((r = i.return) && r.call(i), 0)
                                        : i.next) &&
                                !(r = r.call(i, t[1])).done)
                        )
                            return r;
                        switch (((i = 0), (t = r ? [2 & t[0], r.value] : t)[0])) {
                            case 0:
                            case 1:
                                r = t;
                                break;
                            case 4:
                                return a.label++, {value: t[1], done: !1};
                            case 5:
                                a.label++, (i = t[1]), (t = [0]);
                                continue;
                            case 7:
                                (t = a.ops.pop()), a.trys.pop();
                                continue;
                            default:
                                if (!(r = 0 < (r = a.trys).length && r[r.length - 1]) && (6 === t[0] || 2 === t[0])) {
                                    a = 0;
                                    continue;
                                }
                                if (3 === t[0] && (!r || (t[1] > r[0] && t[1] < r[3]))) {
                                    a.label = t[1];
                                    break;
                                }
                                if (6 === t[0] && a.label < r[1]) {
                                    (a.label = r[1]), (r = t);
                                    break;
                                }
                                if (r && a.label < r[2]) {
                                    (a.label = r[2]), a.ops.push(t);
                                    break;
                                }
                                r[2] && a.ops.pop(), a.trys.pop();
                                continue;
                        }
                        t = n.call(e, a);
                    } catch (e) {
                        (t = [6, e]), (i = 0);
                    } finally {
                        o = r = 0;
                    }
                if (5 & t[0]) throw t[1];
                return {value: t[0] ? t[1] : void 0, done: !0};
            }
        };
Object.defineProperty(n, "__esModule", {value: !0});
var c,
    l = e("index"),
    u = e("player-theme"),
    p = e("game"),
    t = cc._decorator,
    e = t.ccclass,
    t = t.property,
    e =
        ((c = cc.Component),
        i(h, c),
        (h.prototype.start = function () {
            this.targetAnim.node.active = !1;
        }),
        (h.prototype.playAnim = function () {
            (this.targetAnim.node.opacity = 0), (this.targetAnim.node.active = !0), this.targetAnim.play("Target1");
        }),
        (h.prototype.loadTargetLabel = function (i) {
            return a(this, void 0, void 0, function () {
                var t, n, o;
                return s(this, function (e) {
                    switch (e.label) {
                        case 0:
                            return this.targetLabel
                                ? ((t = u.playerTheme.getCoinLabelNames()),
                                  i - 1 < 0 || i - 1 >= t.length
                                      ? (console.error("loadCoinLabel error this.curNum:", i), [2])
                                      : ((n = t[i - 1]), [4, l.ResUtil.loadSpritFrame("Texture/" + n)]))
                                : [3, 2];
                        case 1:
                            (o = e.sent()), (this.targetLabel.spriteFrame = o), (e.label = 2);
                        case 2:
                            return (
                                this.targetNumber &&
                                    ((this.targetNumber.string = i.toString()),
                                    (n = p.default.ins.getColors()),
                                    (o = Math.floor((i - 1) / n.length)),
                                    (o = i - o * n.length),
                                    (this.targetNumber.node.color = n[o - 1])),
                                [2]
                            );
                    }
                });
            });
        }),
        (h.prototype.loadTargetLabelBg = function (e) {
            e -= Math.floor((e - 1) / this.targetBgSps.length) * this.targetBgSps.length;
            this.targetLabelBg.spriteFrame = this.targetBgSps[e - 1];
        }),
        r([t(cc.Sprite)], h.prototype, "targetLabel", void 0),
        r([t(cc.Label)], h.prototype, "targetNumber", void 0),
        r([t(cc.Sprite)], h.prototype, "targetLabelBg", void 0),
        r([t(cc.Animation)], h.prototype, "targetAnim", void 0),
        r([t([cc.SpriteFrame])], h.prototype, "targetBgSps", void 0),
        r([e], h));
function h() {
    var e = (null !== c && c.apply(this, arguments)) || this;
    return (
        (e.targetLabel = null),
        (e.targetNumber = null),
        (e.targetLabelBg = null),
        (e.targetAnim = null),
        (e.targetBgSps = []),
        e
    );
}
n.default = e;
